import { pageList, detail } from './comInstance'
import { DBNames } from '@/enum/dbName'

// 园区分页列表
export interface IDicCode {
  name: string
  type: number
  typeKey: string
}

export interface IPageInfo {
  pageNum: number
  pageSize: number
}

export interface IPageListParams {
  conditions?: Record<string, unknown>
  dicCodes?: IDicCode[]
  fields?: Record<string, unknown>
  pageInfo?: IPageInfo
  sort?: Record<string, unknown>
}

export const getParkPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_PARK })
}

export const getParkDetail = (id: string) => {
  return detail({ id, templateName: DBNames.B_CONSOLE_PARK })
}

export const getProjectPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_PROJECT })
}

export const getLandPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_LAND })
}

export const getBuildingPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_BUILDING })
}

export const getWorkshopPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_WORKSHOP })
}

export const getShopPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_SHOP })
}

export const getDepositoryPageList = (params: IPageListParams) => {
  return pageList({ ...params, templateName: DBNames.B_CONSOLE_DEPOSITORY })
}
